<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 监听窗口改变尺寸事件
        window.onresize = function () {
            var root = document.documentElement;
            console.log('窗口改变尺寸了', root.clientWidth, root.clientHeight);
        }
    </script>
</body>

</html>